﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="sousuoshipu.aspx.cs" Inherits="Catering.Catering_Page.Caipin.Caipin_jcsz.sousuoshipu" %>

<!DOCTYPE html PUBLIC "-//W3C//Dtd XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/Dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=7" />
    <title>菜品管理</title>
    <link rel="stylesheet" type="text/css" href="../../../../Style/head.css" />
    <link rel="stylesheet" type="text/css" href="../../../../Style/center.css" />
    <link href="../../../../Style/StyleSheet.css" rel="stylesheet" type="text/css" />
    <link href="../../../../Style/jquery.treeview.css" rel="stylesheet" type="text/css" />
    <link href="../../../../Style/tinybox_style.css" rel="stylesheet" type="text/css" />
    <link href="../../../Style/zhezhao.css" rel="stylesheet" type="text/css" />
    <script src="../../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script src="../../../Scripts/jquery.js" type="text/javascript"></script>
    <script src="../../../Scripts/jquery.cookie.js" type="text/javascript"></script>
    <script src="../../../Scripts/jquery.treeview.js" type="text/javascript"></script>
    <script src="../../../Scripts/jquery.treeview.edit.js" type="text/javascript"></script>
    <script src="../../../Scripts/tinybox.js" type="text/javascript"></script>
    <script src="../../../../Style/xxk.js" type="text/javascript"></script>
    <script src="../../../Scripts/zhezhao.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript" src="../../../Scripts/My97DatePicker/WdatePicker.js"></script>
    <style type="text/css">
        .Create_Recipe
        {
            margin-top: 0;
        }
        .Create_Recipe
        {
            border: 1px solid #159aec;
            border-top: none;
            width: 998px;
        }
        .soso_lt
        {
            padding: 5px 0;
        }
        .soso_lt a
        {
            margin-left: 3px;
        }
        
        .table_shipu{background: url("../../../Images/div_h1_bg_02.gif") repeat-x 0px 0px;}
        .table_shipu td{ vertical-align:middle; height:35px;}
        .Red{color:Red;}
    </style>
    <!--我的食谱-->
    <script language="javascript" type="text/javascript">
        function Tr_Edit(shipuid,shipuname) {
            $("#Hidshipuid").val(shipuid);
            $("#txt_name").val(shipuname);
            divshow("div_main", "div_bg");
        }

        function Tr_Edit_BiaoZhun(shipuid,flag) {
            $.ajax({
                type: "Post",
                url: "sousuoshipu.aspx/Edit_Shipu_BiaoZhun",
                data: "{'ShipuID':'" + shipuid + "','Flag':" + flag + "}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    if (data.d == "OK") {
                        alert("修改成功！");
                        history.go(0);
                    }
                }
            });
        }

        function Tr_Save_Edit() {
            var shipuid = $("#Hidshipuid").val();
            var shipuname = $("#txt_name").val();
            $.ajax({
                type: "Post",
                url: "sousuoshipu.aspx/Edit_Shipu",
                data: "{'ShipuID':'" + shipuid + "','ShipuName':'" + shipuname + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    if (data.d == "OK") {
                        alert("保存成功！");
                        history.go(0);
                    }
                }
            });
        }

        function ShipuClone(op) {
            var classid = $("#Dr_Class").val();
            $.ajax({
                type: "Post",
                url: "sousuoshipu.aspx/Clone_Shipu",
                data: "{'StrShipuID':'" + op + "','StrClassID':'" + classid + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    if (data.d[0] == "OK") {
                        var strhref = "shipu_clone01.aspx?cid=" + data.d[1] + "&classid=" + data.d[2];
                        window.open(strhref, '_blank');
                        //window.open("shipu_clone01.aspx?cid=" + data.d[1] + "&classid=" + data.d[2]);
                    }
                    else {
                        alert("参数错误！");
                    }
                }
            });
            
        }
    </script>

    <!--批量删除-->
    <script type="text/javascript">
        $(document).ready(function () {
            $("#ck_AllSelect").change(function () {
                if ($(this).attr("checked") == true || $(this).attr("checked") == "checked") {
                    $("#RecipesList input[type='checkbox']").attr("checked",true);
                }
                else {
                    $("#RecipesList input[type='checkbox']").attr("checked", false);
                }
            });
        });

        function BatchDel() {
            if (!confirm("确定删除选中的食谱？")) {
                return;
            }

            var RecipesIDS = ""; //食谱ID集合
            $("#RecipesList input[type='checkbox']").each(function () {
                if ($(this).attr("checked") == true || $(this).attr("checked") == "checked") {
                    RecipesIDS += $(this).val() + ",";
                }
            });
            if (RecipesIDS.length > 0) {
                RecipesIDS = RecipesIDS.substring(0, RecipesIDS.length - 1);
            }
            else {
                alert("请选择要删除的食谱！");
                return;
            }
            $.ajax({
                type: "Post",
                url: "sousuoshipu.aspx/BatchDel",
                data: "{'RecipesIDS':'" + RecipesIDS + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    if (data.d == "OK") {
                        alert("删除成功！");
                        $("#RecipesList input[type='checkbox']").each(function () {
                            if ($(this).attr("checked") == true || $(this).attr("checked") == "checked") {
                                $(this).parents("tr").remove();
                            }
                        });
                    }
                    else {
                        alert(data.d);
                    }
                }
            });


        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div class="Center_Content" id="div2_5" style="height:auto; margin-bottom:50px;">
        <div class="div_0207 left_width500" style="width:998px; height:auto;">
            <table width="100%" class="table_shipu" border="0" cellspacing="0" cellpadding="0">
                <thead>
                    <tr>
                        
                        <td width="60" align="right">作业区：</td>
                        <td width="150">
                            <asp:DropDownList ID="Dr_Operaction" runat="server" CssClass="select_input_bg" Width="140" AutoPostBack="True" OnSelectedIndexChanged="Dr_Operaction_SelectedIndexChanged"></asp:DropDownList>
                        </td>
                        <td width="45" align="right">班组：</td>
                        <td width="150">
                            <asp:DropDownList ID="Dr_Class" runat="server" Width="140" CssClass="select_input_bg" ></asp:DropDownList>
                        </td>
                        <td width="65" align="right">选择年月：</td>
                        <td width="100">
                            <asp:TextBox runat="server" ID="SearchDate" CssClass="input_bg" Width="80"></asp:TextBox>
                        </td>                     
                        <td align="left" width="100">
                            <asp:Button runat="server" ID="select_shipu" Text="查询" CssClass="input_btn_a" OnClick="select_sihpu_click" />
                        </td>
                        <td align="left">
                            <input type="button" id="btn_DelRecipes" value="批量删除" onclick="BatchDel()" class="input_btn_a" />
                        </td>
                        <td width="10"></td>
                    </tr>
                </thead>
            </table>
            <div style="height:502px; overflow-x:hidden; overflow-y:auto;">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="swxx_table" style="margin:0px; padding:0px;">
                <thead>
                    <tr>
                        <td width="10%"><input type="checkbox" id="ck_AllSelect"  value="0"/>序号</td>
                        <td width="30%">名称</td>
                        <td width="10%">配餐开始日期</td>
                        <td width="10%">配餐截止日期</td>
                        <td width="10%">制作人</td>
                        <td width="10%">标准食谱</td>
                        <td colspan="2" width="10%">操作</td>
                        <td width="10%" style="border-right:none;">复制食谱</td>
                    </tr>
                </thead>
                <tbody id="RecipesList">
                    <asp:Repeater ID="Repeater1" runat="server" 
                        onitemcommand="Repeater1_ItemCommand" 
                        onitemdatabound="Repeater1_ItemDataBound" >
                        <ItemTemplate>
                            <tr id="shipu_<%#Eval("id")%>" style="background:#ffffff;" onmouseover="this.style.background='#E3F5FF'" onmouseout="this.style.background='#FFFFFF'">
                                <td class="xh_td"><input type="checkbox" value="<%#Eval("id")%>" /> <%#Container.ItemIndex+1 %></td>                                
                                <td align="center"><a href="/Catering_Page/Caipin/Caipin_jcsz/shipu_clone05.aspx?RecipesId=<%#Eval("id")%>" target="mainFrame"><%#Eval("CateringName")%></a></td>
                                <td align="center"><%#Convert.ToDateTime(Eval("StateDate")).ToString("yyyy-MM-dd")%></td>
                                <td align="center"><%#Convert.ToDateTime(Eval("StopDate")).ToString("yyyy-MM-dd")%></td>
                                <td align="center"><%#Eval("EditPersonnelName")%></td>
                                <td align="center"><%#this.GetBiaoZhunStr(Eval("id").ToString(), Eval("IsBiaoZhun").ToString(), Eval("ClassIDs").ToString())%></td>
                                <td align="center">
                                    <%#this.EditCateringName(Eval("id").ToString(), Eval("CateringName").ToString(), Eval("ClassIDs").ToString())%>
                                </td>
                                <td align="center">
                                    <asp:ImageButton ID="BtnDel" runat="server" ImageUrl="/Images/trash.gif" CommandName="Del" OnClientClick="return confirm('确定删除?')" CommandArgument=<%#Eval("id").ToString()%> />
                                </td>
                                <td align="center"><%#this.GetStrCloneRecipes(Eval("id").ToString())%></td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </tbody>
            </table>
            </div>
        </div>
    </div>
    <!--弹出层-->
<div id="div_bg" class="bg"></div>
<div id="div_main" class="center_div" style="padding:0px; margin-top:-130px; width:280px;">
    <div class="div_0207" style="width:278px; margin-top:0px;">
        <table border="0" cellpadding="0" cellspacing="0" width="100%" style="background-color:#E5F1FD;">
            <tr>
                <td><h1 style="background-image:none;"><img src="../../../Images/cp_h1_03.gif" />修改食谱</h1></td>
                <td width="36" align="center"><a href="javascript:void(0);" onclick="divhidel('div_main', 'div_bg')">关闭</a></td>
            </tr>
        </table>
    </div>
    <table border="0" cellpadding="0" cellspacing="0" align="center">
        <tr>
            <td height="36" width="70" align="right">食谱名称：<input type="hidden" id="Hidshipuid" value="0" /></td>
            <td width="130"><input type="text" id="txt_name" style="width:130px;" class="input_bg" /></td>            
        </tr>
        <tr>
            <td align="center" height="50">
                <input type="button" id="btn_Save_Edit" onclick="Tr_Save_Edit()" value="提　交" class="input_btn_a" />
            </td>
            <td align="right">
                <input type="button" id="btn_quxiao" onclick="divhidel('div_main', 'div_bg')" value="取　消" class="input_btn_a" />
            </td>
        </tr>
    </table>
</div>
    </form>
</body>
</html>
